import { BaseItem } from "../../common/BaseItem";
import { TSkill } from "../../../../../Message/Db/Tables/TSkill";
import { ObjCreate } from "../../common/ObjCreate";
import { ImagesConst } from "../../../resource/ImagesConst";
import { GameDefConfig } from "../../../resource/GameDefConfig";
import { HTMLUtil } from "../../../../../com/gengine/utils/HTMLUtil";
import { Language } from "../../../../../extend/language/Language";
import { SkillConfig } from "../../../resource/SkillConfig";
import { ToolTipInfo } from "../../../model/ToolTipInfo";
import { Tooltip } from "../../common/tooltip/Tooltip";
//class PetSpecialSkillBaseItem
    
    export  class PetSpecialSkillBaseItem extends BaseItem
    {
        constructor()
        {
            super();
            return;
        }

        public set skill(arg1: TSkill)
        {
            this._skill = arg1;
            if (this._skill) 
            {
                this.source = this._skill.skillIcon + ".jpg";
            }
            else 
            {
                this.source = null;
            }
            this.drawNow();
            return;
        }

        protected /* override */ createChildren(): void
        {
            ObjCreate.createBitmap(ImagesConst.PackItemBg, -3, -3, this);
            super.createChildren();
            return;
        }

        public /* override */ get toolTipData()
        {
            var loc3=null;
            var loc1="";
            var loc2="";
            if (this._skill) 
            {
                loc2 = GameDefConfig.instance.getSkillUseType(this._skill.useType).name;
                loc1 = loc1 + ("<font color=\'#F5FF00\'size=\'14\'><b>" + this._skill.skillName + "</b></font><br>");
                loc1 = loc1 + HTMLUtil.addColor(Language.getString(54088) + "    Lv." + this._skill.skillLevel + "<br><br>", "#a768c6");
                loc1 = loc1 + HTMLUtil.addColor(this._skill.skillDescription + "<br><br>", "#ffffff");
                loc3 = SkillConfig.instance.getInfoByName(this._skill.skillLevel + 1);
                if (loc3) 
                {
                    loc1 = loc1 + HTMLUtil.addColor(Language.getString(28071) + "    Lv." + loc3.skillLevel + "<br><br>", "#a768c6");
                    loc1 = loc1 + HTMLUtil.addColor(loc3.skillDescription + "<br><br>", "#ffffff");
                }
                loc1 = loc1 + HTMLUtil.addColor(Language.getString(54090) + loc2 + "<br>", "#f5ff00");
                loc1 = loc1 + HTMLUtil.addColor(Language.getString(54092) + this._skill.attackDistance + "<br>", "#f5ff00");
                loc1 = loc1 + HTMLUtil.addColor(Language.getString(54093) + this._skill.cooldownTime / 1000 + Language.getString(54089) + "<br>", "#f5ff00");
                return new ToolTipInfo(Tooltip.ToolTipRenderType_ShortcutItem, loc1);
            }
            return null;
        }

        /* internal */ /* var */_skill: TSkill;
    }
